package com.geek.ch06.anno;

import com.geek.entity.Items;
import com.geek.entity.OrderDetails;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface OrderDetailMapper {

    //通过订单ID，查询其所有的订单明细
    @Select("select * from orderdetail where orders_id = #{oid}")
    @Results({
            @Result(id = true , property = "id" , column = "id"),
            @Result(property = "items" , column = "items_id" ,javaType = Items.class ,
                one = @One(select = "com.geek.ch06.anno.ItemsMapper.findItemsById"))
    })
    public List<OrderDetails> findDetailsByOid(int oid) ;

}
